package com.gohome.gohomechat.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

/**
 * Created by dllo on 16/1/8.
 */
public class ToActivityUtil {


    /**
     * activity的跳转
     * @param from
     * @param to
     */
    public static void startToActivity(Context from, Class to) {
        Intent intent = new Intent(from, to);
        from.startActivity(intent);
    }

    /**
     * 带传参的activity跳转
     * @param from
     * @param to
     * @param bundle
     */
    public static void startToActivity(Context from, Class to, Bundle bundle) {
        Intent intent = new Intent(from, to);
        intent.putExtras(bundle);
        from.startActivity(intent);
    }

    public static Bundle fromSrc(Context context) {
        Intent intent = ((Activity) context).getIntent();
        return intent.getExtras();
    }
}
